import { post } from '@/request/http'
import store from '@/store'

/**
 * 权限管理
 *  1. 角色列表查询 getAuthList
 */

export const GetAuthList = ({
  roleType
}) =>
  post(
    '/FTKJWLHYPT/ControlPath?act=list&actKey=SysRights&Section=lista&SessionId=' +
    store.state.user.SessionId_DX_H,
    {
      Data: {
        Filters: {
          FTKJWLHYPT: {
            roleType,
            fltUuid: store.state.user.fltUuid_DX_H
          }
        },
        Orderbys: {},
        PageIndexs: {},
        PageSizes: {}
      }
    }
  )

export const GetAuthMenu = ({
  ROLE_UUID
}) =>
  post(
    '/FTKJWLHYPT/ControlPath?act=list&actKey=SysRights&Section=listb&SessionId=' +
    store.state.user.SessionId_DX_H,
    {
      Data: {
        Filters: {
          FTKJWLHYPT: {
            fltUuid: store.state.user.fltUuid_DX_H,
            roleUuid: String(ROLE_UUID)
          }
        },
        Orderbys: {},
        PageIndexs: {},
        PageSizes: {}
      }
    }
  )

export const SaveAuth = ({
  ROLE_UUID,
  MENU
}) =>
  post(
    '/FTKJWLHYPT/ControlPath?act=add&actKey=SysRights&Section=AddSysRights&SessionId=' +
    store.state.user.SessionId_DX_H,
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            fltUuid: store.state.user.fltUuid_DX_H,
            roleUuid: String(ROLE_UUID),
            creator: store.state.user.USR_CODE_DX_H,
            MENU
          }
        }
      }
    }
  )
